
#import "KRedEnvelopeModel.h"

@implementation KRedEnvelopeModel
- (instancetype)initWithDictionary:(NSDictionary*)dictionary
{
    self = [super init];
    if (self) {
        [self setValuesForKeysWithDictionary:dictionary];
    }
    return self;
}
-(instancetype)init
{
    self = [super init];
    if (self) {
        _TotalData = @"";
        _RecordCount = @"";
        _DataList = @[];
        _PageIndex = @"";
    }
    return self;
}
+ (instancetype)initWithDictionary:(NSDictionary*)dictionary
{
    return [[self alloc] initWithDictionary:dictionary];
}
- (void)setValue:(id)value forUndefinedKey:(NSString*)key
{}

- (void)setValue:(id)value forKey:(NSString*)key
{
    if ([key isEqualToString:@"DataList"]) {
        NSMutableArray* _arrM = [NSMutableArray array];
        for (NSDictionary* dict in value) {
            KRedEnvelopeDataListModel* model = [KRedEnvelopeDataListModel initWithDictionary:dict];
            [_arrM addObject:model];
        }
        _DataList = _arrM.copy;
        return;
    }
    
    [super setValue:value forKey:key];
}

- (void)setTotalData:(NSString*)TotalData{
    _TotalData = [[KUntils ValueToString:TotalData]copy];
}
- (void)setRecordCount:(NSString*)RecordCount{
    _RecordCount = [[KUntils ValueToString:RecordCount]copy];
}
- (void)setDataList:(NSString*)DataList{
    _DataList = [DataList copy];
}
- (void)setPageIndex:(NSString*)PageIndex{
    _PageIndex = [[KUntils ValueToString:PageIndex]copy];
}
@end
